package com.bw.shop2208a.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.bw.shop2208a.entity.SearchHistoryEntity

@Dao
interface SearchDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertSearch(searchHistoryEntity: SearchHistoryEntity)
    @Query("delete from search_history where name=:name")
    fun deleteSearch(name:String)
    //按时间顺序排序---desc 倒叙
    @Query("select*from search_history order by time desc")
    fun getHistory():List<SearchHistoryEntity>
}